package taskone;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author wuwenfa
 */
public class Main {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //继承Thread类 重写run
        Thread threadOne = new ThreadOne();
        threadOne.start();

        //实现Runnable 重写run
        Runnable runnable = new ThreadTwo();
        Thread threadTwo = new Thread(runnable);
        threadTwo.start();

        //实现Callable 重写call + FutureTask
        ThreadThree threadThree = new ThreadThree();
        FutureTask<Object> futureTask = new FutureTask<>(threadThree);
        Thread thread = new Thread(futureTask);
        thread.start();
        Object result = futureTask.get();

    }
}
